package com.ruoyi.web.controller.laiqianba.merchant;

import com.ruoyi.account.service.IAccountMerchantInfoHisService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.db.domain.AccountMerchantInfoHis;
import org.apache.commons.codec.binary.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 商户基本信息Controller
 *
 * @author ruoyi
 * @date 2023-08-12
 */
@RestController
@RequestMapping("/merchant/account")
public class MerchantAccountInfoController extends BaseController {

    @Autowired
    private IAccountMerchantInfoHisService accountMerchantInfoHisService;

    /**
     * 查询商户基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('merchant:account:list')")
    @GetMapping("/list")
    public TableDataInfo list(AccountMerchantInfoHis accountMerchantInfoHis) {

        Long deptId = SecurityUtils.getDeptId();
        if (StringUtils.equals(deptId.toString(),"201")){
            accountMerchantInfoHis.setOwnerId(SecurityUtils.getUserId().intValue());
        }

        List<Map<String, Object>> list = accountMerchantInfoHisService.selectAccountHisMapList1(accountMerchantInfoHis);
        return getDataTable(list);
    }



}
